package com.nbsaas.boot.wms.rest.convert;

import com.nbsaas.boot.wms.data.entity.Warehouse;
import com.nbsaas.boot.wms.api.domain.simple.WarehouseSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
 * 仓库-列表对象转换器
 */

public class WarehouseSimpleConvert implements Converter<WarehouseSimple, Warehouse> {


    @Override
    public WarehouseSimple convert(Warehouse source) {
        WarehouseSimple result = new WarehouseSimple();

        result.setZipCode(source.getZipCode());
        result.setShippingCycle(source.getShippingCycle());
        result.setNoAcceptanceByHeadquarters(source.getNoAcceptanceByHeadquarters());

        try {
            if (source.getCatalog() != null) {
                result.setCatalog(source.getCatalog().getId());
            }
        } catch (Exception ignored) {
        }

        result.setModifier(source.getModifier());
        result.setChannel(source.getChannel());
        result.setDiscount(source.getDiscount());
        result.setWmsOwnerCode(source.getWmsOwnerCode());
        result.setProvince(source.getProvince());
        result.setPager(source.getPager());
        result.setId(source.getId());
        result.setFax(source.getFax());
        result.setLat(source.getLat());
        result.setLastInventoryDate(source.getLastInventoryDate());
        result.setLastDate(source.getLastDate());
        result.setLng(source.getLng());
        result.setE3ExternalCode(source.getE3ExternalCode());
        result.setWmsExternalCode(source.getWmsExternalCode());
        result.setModifyDate(source.getModifyDate());
        result.setNoOverflowStockControl(source.getNoOverflowStockControl());
        result.setNoInspection(source.getNoInspection());

        try {
            if (source.getCatalog() != null) {
                result.setCatalogName(source.getCatalog().getName());
            }
        } catch (Exception ignored) {
        }

        result.setPhone(source.getPhone());
        result.setDistrict(source.getDistrict());
        result.setName(source.getName());
        result.setOriginalCode(source.getOriginalCode());
        result.setBatchManagementMode(source.getBatchManagementMode());
        result.setSalesman(source.getSalesman());
        result.setRegion(source.getRegion());
        result.setExternalCodeErp(source.getExternalCodeErp());
        result.setWmsAreaCode(source.getWmsAreaCode());
        result.setCode(source.getCode());
        result.setCity(source.getCity());
        result.setContactPerson(source.getContactPerson());
        result.setRemark(source.getRemark());
        result.setMarketingArea(source.getMarketingArea());
        result.setDefectiveWarehouse(source.getDefectiveWarehouse());
        result.setShippingPriceSetting(source.getShippingPriceSetting());
        result.setDisabled(source.getDisabled());
        result.setReturnPriceSetting(source.getReturnPriceSetting());
        result.setEmail(source.getEmail());
        result.setCreateDate(source.getCreateDate());
        result.setCreator(source.getCreator());
        result.setAddress(source.getAddress());
        result.setNoNegativeStockControl(source.getNoNegativeStockControl());
        result.setManager(source.getManager());
        result.setWarehouseFunction(source.getWarehouseFunction());
        result.setNature(source.getNature());
        result.setAttr6(source.getAttr6());
        result.setMobile(source.getMobile());
        result.setAttr5(source.getAttr5());
        result.setAttr2(source.getAttr2());
        result.setAttr1(source.getAttr1());
        result.setAddDate(source.getAddDate());
        result.setAttr4(source.getAttr4());
        result.setAttr3(source.getAttr3());
        result.setAllBrands(source.getAllBrands());
        result.setNoInsufficientStockControl(source.getNoInsufficientStockControl());
        result.setNoUniqueCodeCheck(source.getNoUniqueCodeCheck());
        result.setExternalCodePos(source.getExternalCodePos());
        result.setNoApprovalByHeadquarters(source.getNoApprovalByHeadquarters());
        result.setCategory(source.getCategory());
        result.setAdaptorCode(source.getAdaptorCode());


        return result;
    }

}